Aggregate(TSource, TAccumulate) Method (ParallelQuery(TSource), TAccumulate, Func(TAccumulate, TSource, TAccumulate))

Task Parallel System.Threading

Applies in parallel an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.

Namespace:  System.Linq
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Public Shared Function Aggregate(Of TSource, TAccumulate) ( _
	source As ParallelQuery(Of TSource), _
	seed As TAccumulate, _
	func As Func(Of TAccumulate, TSource, TAccumulate) _
) As TAccumulate
C#
public static TAccumulate Aggregate<TSource, TAccumulate>(
	ParallelQuery<TSource> source,
	TAccumulate seed,
	Func<TAccumulate, TSource, TAccumulate> func
)

Parameters

source
Type: System.Linq..::.ParallelQuery<(Of <(TSource>)>)
A sequence to aggregate over.
seed
Type: TAccumulate
The initial accumulator value.
func
Type: System..::.Func<(Of <(TAccumulate, TSource, TAccumulate>)>)
An accumulator function to be invoked on each element.

Type Parameters

TSource
The type of the elements of source.
TAccumulate
The type of the accumulator value.

Return Value

The final accumulator value.

Exceptions

ExceptionCondition
System..::.ArgumentNullException source or func is a null reference (Nothing in Visual Basic).
System..::.AggregateException One or more exceptions occurred during the evaluation of the query.
System..::.OperationCanceledException The query was canceled.

See Also